package Structural_design_pattern.Facade_Pattern.Example2;

public class GeneralSwitchFacade {
    private Light[] lights = new Light[4];
    private Fan fan;
    private AirConditioner ac;
    private Television tv;

    public GeneralSwitchFacade(){
        lights[0] = new Light("左前");
        lights[1] = new Light("右前");
        lights[2] = new Light("左后");
        lights[3] = new Light("右后");
        fan = new Fan();
        ac = new AirConditioner();
        tv = new Television();
    }

    public void on(){
        for(Light light : lights){
            light.on();
        }
        fan.on();
        ac.on();
        tv.on();
    }

    public void off(){
        for(Light light : lights){
            light.off();
        }
        fan.off();
        ac.off();
        tv.off();
    }
}
